@extends('layouts.app', ['activePage' => 'admin', 'titlePage' => __('俱乐部管理员管理')])
@section('content')
<div class="content">
  <div class="container-fluid">
      <div class="card">
          <div class="card-header card-header-primary">
              <h4 class="card-title">俱乐部管理员列表</h4>
              <p class="card-category"> 俱乐部管理员的审核与查看 </p>
              {{-- <button onclick="window.location.href = 'admins/create'" class="btn btn-info btn-round float-right">
                <i class="material-icons">add</i> 新增课程
            </button> --}}
          </div>

          <div class="card-body ">

              @if (session('message'))
              <div class="row">
                  <div class="col-sm-12">
                      <div class="alert alert-success">
                          <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                              <i class="material-icons">close</i>
                          </button>
                          <span>{{ session('message') }}</span>
                      </div>
                  </div>
              </div>
              @endif
              <div class="row justify-content-between">
                  <div class="col-md-auto mr-auto">
                      <ul class="nav">
                          <li class="nav-item">
                              <a class="nav-link active" href="?type">全部({{$all}})</a>
                          </li>
                          <li class="nav-item">
                              <a class="nav-link" href="?type=0">已禁用({{$status0}})</a>
                          </li>
                          <li class="nav-item">
                              <a class="nav-link" href="?type=1">已启用({{$status1}})</a>
                          </li>
                      </ul>
                  </div>
                  <div class="col-auto">
                      <form class="navbar-form navbar-search" method="get">
                          <div class="input-group no-border">
                              <input type="text" name="search" class="form-control" placeholder="搜索管理员...">
                              <button type="submit" class="btn btn-white btn-round btn-just-icon">
                                  <i class="material-icons">search</i>
                                  <div class="ripple-container"></div>
                              </button>
                          </div>
                      </form>
                  </div>
                  <div class="col-auto">
                    <a href="{{ route('admins.create') }}" class="btn btn-sm btn-primary"><i class="material-icons">add</i>新增管理员</a>
                  </div>
              </div>

              <table class="table">
                <thead>
                    <tr class="text-center text-primary">
                        <th>编号</th>
                        <th>账号</th>
                        <th>俱乐部</th>
                        <th>联系方式</th>
                        <th>创建时间</th>
                        <th>状态</th>
                        <th>操作</th>
                    </tr>
                </thead>
                @foreach ($admins as $admin)
                <tbody>
                    <tr class="text-center">
                        <td>{{ $loop->iteration }}</td>
                        <td>{{ $admin-> username}}</td>
                        <td><a href="clubs/{{$admin->club_id}}" class="alert-link">{{$admin->clubname}}</a></td>
                        <td>{{ $admin-> tel}}</td>
                        <td>{{ $admin->created_at}}</td>
                        <td>
                            @switch($admin->status)
                            @case('1') <span class="badge badge-success">已启用</span> @break
                            @case('0') <span class="badge badge-danger">已禁用</span> @break
                            @endswitch
                        </td>
                        <td class="td-actions">
                          {{-- <button type="submit" class="btn btn-info btn-link btn-lg">切换状态</button> --}}
                          <button type="button" class="btn btn-primary btn-link btn-lg" data-toggle="modal" data-target="#exampleModal{{$admin->id}}">
                              切换状态
                          </button>
                          @includeIf('admins.change_admin_state_dialog')
                        </td>
                    </tr>
                </tbody>
                @endforeach

            </table>

          </div>
      </div>
  </div>
</div>
@endsection

